<template>
    <div class="price-info-bar text-small clearfix">
        <span v-if="label" class="fl">{{label}}</span>
        <span v-if="priceText" class="fr">￥{{priceText}}</span>
    </div>
</template>

<script>
import {
    isUndef,
    currency,
} from '@/lib/utils';

export default {
    name: 'PriceInfoBar',
    props: {
        /** 标题 */
        label: {
            type: String,
        },
        /** 价格 */
        price: {
            type: Number,
        },
    },
    computed: {
        priceText() {
            if (isUndef(this.price)) {
                return this.price;
            }
            return currency(this.price);
        },
    },
};
</script>

<style lang="less">
@import "../../lib/style/mixins.less";

.price-info-bar {
    padding: 22rpx 0;
    .inner {
        padding-left: 40rpx;
        .item {
            margin: 10rpx 0;
        }
    }
}
</style>
